<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        
        <ui:define name="title">
            <h:outputText value="#{bundle['Users.Add.Title']}"></h:outputText>
        </ui:define>
        <ui:define name="menu">
            <div class="block_menu">
                <h:form>
                    <div class="block_menu_left">
                        <h:commandLink action="/index" value="#{bundle['Menu.Main']}"/>
                    </div>
                    <div class="block_menu_left">
                        <h:commandLink action="/notes/List" value="#{bundle['Menu.Notes']}"/>
                    </div>
                    
                    <h:panelGroup rendered="#{userManagerController.isAuthenticated() == 0}">
                        <div class="block_menu_right">
                            <h:commandLink action="/authenticate/Registration" value="#{bundle['Menu.Registration']}"/>
                        </div>

                        <div class="block_menu_right">
                            <h:commandLink action="/authenticate/Login" value="#{bundle['Menu.Login']}"/>
                        </div>
                    </h:panelGroup>
                    <h:panelGroup rendered="#{userManagerController.isAuthenticated() == 1}">
                        <div class="block_menu_right">
                            <h:commandLink action="#{userManagerController.logout()}" value="#{bundle['Menu.Logout']}"/>
                        </div>
                        
                        <div class="block_menu_right">
                            <h:commandLink action="/profile/View" value="Hello #{userManagerController.getAuthenticatedUserName()}"/>
                        </div>     
                        <h:panelGroup rendered="#{userManagerController.isRoleAdmin() == 1}">
                            <div class="block_menu_left_action">
                                <h:commandLink action="/users/List" value="#{bundle['Menu.User.BackToUsersManagement']}"/>
                            </div>
                        </h:panelGroup>
                    </h:panelGroup>
                </h:form>
            </div>
        </ui:define>
        <ui:define name="body">
        <h:messages errorClass="error" infoClass="info" />
        <center>
            <div style="padding-top: 75px;">

                <h:form>
                    <h:panelGrid columns="2" columnClasses="loginFormFirst,loginFormSecond" >
                        <h:outputLabel value="#{bundle['Users.Add.Label.Login']}" 
                            for="login" style="font: 16pt 'Segoe WP';  color: #707070;"/>
                        
                        <h:inputText id="login" value="#{userController.login}" 
                            title="#{bundle['Users.Add.Title.Login']}" 
                            required="true" 
                            requiredMessage="#{bundle['Users.Add.RM.Login']}"
                            style="width: 150px; height: 30px; padding-left: 5px;  font: 12pt 'Segoe WP';color: #707070;
                                background-color: #ffffff; border: 2px solid #707070;"/> 
                    </h:panelGrid>
                    
                    <h:panelGrid columns="2" columnClasses="loginFormFirst,loginFormSecond" >

                        <h:outputLabel value="#{bundle['Users.Add.Label.Password']}" 
                            for="password" style="font: 16pt 'Segoe WP';  color: #707070;"/>
                        <h:inputText id="password" required="true" 
                            value="#{userController.password}" 
                            title="#{bundle['Users.Add.Title.Password']}" 
                            requiredMessage="#{bundle['Users.Add.RM.Password']}"
                            style="width: 150px; height: 30px; padding-left: 5px;  font: 12pt 'Segoe WP';color: #707070;
                                background-color: #ffffff; border: 2px solid #707070;"/>
                    </h:panelGrid>
                    
                    <h:panelGrid columns="2" columnClasses="loginFormFirst,loginFormSecond" >
                        <h:outputLabel value="#{bundle['Users.Add.Label.Email']}" 
                            for="email" style="font: 16pt 'Segoe WP';  color: #707070;"/>
                        <h:inputText id="email" required="true"
                            value="#{userController.email}" 
                            title="#{bundle['Users.Add.Title.Email']}"  
                            requiredMessage="#{bundle['Users.Add.RM.Email']}"
                            style="width: 150px; height: 30px; padding-left: 5px;  font: 12pt 'Segoe WP';color: #707070;
                                background-color: #ffffff; border: 2px solid #707070;"/>
                    </h:panelGrid>
                    
                    <h:panelGrid columns="2" columnClasses="loginFormFirst,loginFormSecond" >
                        <h:outputLabel value="#{bundle['Users.Add.Label.Role']}" 
                            for="role" style="font: 16pt 'Segoe WP';  color: #707070;"/>
                        <h:inputText id="role" required="true"
                            value="#{userController.role}" 
                            title="#{bundle['Users.Add.Title.Role']}"  
                            requiredMessage="#{bundle['Users.Add.RM.Role']}"
                            style="width: 150px; height: 30px; padding-left: 5px;  font: 12pt 'Segoe WP';color: #707070;
                                background-color: #ffffff; border: 2px solid #707070;"/> 
                    </h:panelGrid>
                    
                    <h:panelGrid columns="2" columnClasses="loginFormFirst,loginFormSecond" >
                        <h:outputLabel value="" 
                            for="role" style="font: 16pt 'Segoe WP';  color: #707070;"/>
                        
                        <h:commandButton type="submit" style="width: 160px; height: 45px; font: 16pt 'Segoe WP'; font-weight: bold; 
                                         color: #505050; background-color: #DDFFC5; border: 3px solid #505050;"
                                         value="#{bundle['Menu.User.Save']}" action="#{userController.create}"/>
                    </h:panelGrid>  

                </h:form>
            </div>        
        </center>
        </ui:define>
    </ui:composition>

</html>